VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsEjeComando"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False

Public Function Ejec_Comando_1(sProcAlm As String, ParamArray listaParametros()) As ADODB.Recordset
Dim RsComando As ADODB.Recordset
Set RS = Nothing
On Error GoTo Er
    nCant = UBound(listaParametros()) + 1
    sCadena = ""
    For i = 0 To nCant - 1
        sCadena = sCadena & "'" & listaParametros(i) & "',"
    Next i
    If nCant >= 0 Then sCadena = " " & Left(sCadena, Len(sCadena) - 1)
    SQL = Trim$(sProcAlm) & sCadena
    
    Set RS = New ADODB.Recordset
    RS.Open SQL, Cnn, adOpenDynamic
    Set Ejec_Comando_1 = RS
    Exit Function
Er:
    MsgBox Err.Description, vbInformation + vbCritical
End Function

Public Function Ejec_Comando_2(sProcAlm As String, ParamArray listaParametros()) As ADODB.Command
On Error GoTo Er
    nCant = UBound(listaParametros()) + 1
    Set Cmd = New ADODB.Command
    With Cmd
        .ActiveConnection = Cnn
        .CommandType = adCmdStoredProc
        .CommandTimeout = 0
        .CommandText = sProcAlm$
        If nCant <> 0 Then
            For i = 1 To nCant
                Cmd(i) = listaParametros(i - 1)
                Cadena = Cadena & ", " & listaParametros(i - 1)
            Next i
        End If
        .Execute
    End With
    Set Ejec_Comando_2 = Cmd
    Exit Function
Er:
    MsgBox Err.Description
    Exit Function
End Function

